<?php
class Zend_View_Helper_Packsimple extends Zend_View_Helper_Abstract
{
	private $count;
	
	public function packsimple($obj)
	{
		$this->count = 0;
		$html  = '<h2 class="subTitleHighlight">Nenhum produto encontrado!</h2>';
		
		if( isset( $obj[0] ) )
		{
			$html  = '';
			foreach( $obj as $pack )
			{
				$html .= '	<article class="pack'. (!(++$this->count % 5) ? ' last-child' : '') .'">';
				$html .= '		<a href="'.__LINKS__.'produtos/detalhes/'.$pack->idDetail.'/'.Nadeb_ClearLinks::clear( $pack->name ).'">';
				$html .= '			<img src="'.__ROOT__.'public/uploads/'.$pack->image.'" alt="Modelo">';
				$html .= '			<span class="'.$this->refColor( $pack->idFlag ).'RefColor museo">R$ '.$pack->cost.'</span>';
				$html .= '		</a>';
				$html .= '		<p>';
				$html .= '			<a href="#"><strong class="museo">'.$pack->name.'</strong>';
				$html .= '			'.$pack->description.'</a>'; 
				$html .= '		</p>';
				$html .= '	</article>';
			}
		}
		
		return $html;		
	}
	
	private function refColor($num = 0)
	{
		$matrix = array(
			'1' => 'green',
			'2' => 'blue',
			'3' => 'orange',
			'4' => 'red',
			'5' => 'purple'
		);
		
		return $matrix[ $num ];
	}
}
	